-
Notifications
You must be signed in to change notification settings - Fork 171
prettify code blocks for api site #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@rdworth @jzaefferer Can you provide some feedback on how this relates to the work you're currently doing for qunitjs.com? IIRC you were working on doing the processing on the server prior to publishing. |
Also, it looks like we should clean up our whitespace so that future commits are easy to read :-) |
The qunitjs.com repo is currently using docpad, which we're getting rid of. But the idea is to do the highlighting as part of the deployment, instead of doing it on the client. With gzipped html the overhead should be smaller then highlighting on the client. @rdworth experimented with pygments, but I don't know how far he got. |
I started dissecting how docpad uses pygmentize (command line pygments tool) but didn't get very far. It's basically just stripping that code out (though it's in CoffeeScript) and making a grunt task from it. I'm happy to do it, but might be a couple more days. |
@kswedberg any opinion on server vs client side code highlighting? Might make sense to just go client side for now. |
If we go that route, we need a way for other sites to load this, too: api.jquery.com, api.jqueryui.com, qunitjs.com, probably learn.jquery.com. |
@jzaefferer Ideally, we should do it on the server. If that's too much of a hassle, though, we could do it client side for now until we have a server-side solution in place. If multiple other sites need it, too, we can just load the css/js unconditionally. The prettify.js script looks for Everyone, let me know how you'd like me to proceed with this. I can just close this pull request or close it and send another without the conditional loading. |
As we have no solution for server side rendering right now, let's go with client side. Can you update this PR to apply to more then one site? Does the highlighter have an option to specify the language? Or does it try to auto-detect? |
I'd like one more day. Gonna focus on this for a good part of today and then if I'm still not there we can go ahead. Thanks for your patience. |
Ok, I created a pygmentize wrapper https://github.com/rdworth/node-pygmentize . I've got this working on a test file in api.jquery.com ( see pygmentize branch ), but hit a snag on getting the whole repo switched over. Should make some more progress this weekend. @jzaefferer do you want to try the same on qunitjs.com? |
Implemented node-pygments on qunitjs.com, too, and its here in master, so we can close this PR? |
Closing this, trusting that pygments is working. |
modified header.php and footer.php in jquery theme to conditionally load prettify.css and prettify.js on api site (for code block syntax highlighting).